$(function(){
	$(document).on('click','#login',function(){
		var $userName=$('#user-name'),
		    $pwd=$('#user-pwd');
		if(!$userName.val()) {
            $userName.next().show().find('div').text('请输入用户名');
            return;
        }
        if(!$pwd.val()) {
            $pwd.next().show().find('div').text('请输入密码');
            return;
        }
      $.ajax({
		type:"post",
		url:'http://111.230.44.126:88/api/v1/token/app',
		data:{
			ac:$userName.val(),
			se:$pwd.val()
		},
		//XMLHttpRequest 对象用于在后台与服务器交换数据。
		beforeSend:function(XMLHttpRequest){
		   XMLHttpRequest.setRequestHeader('token', window.base.getLocalStorage('token'));
		},
		success:function(res){
			console.log(res)
			if(res){
			    window.base.setLocalStorage('token',res.token);
			    window.location.href='index.html'	
			}	
		},
		error:function(e){
			$('.common-error-tips').text('帐号或密码错误').show().delay(2000).hide(0);

			
		}
	  })		
	});
	$(document).on('focus','.normal-input',function(){
		$('.common-error-tips').hide();
	});
})